package com.mjw.zstu.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mjw.zstu.entity.Company;
import com.mjw.zstu.entity.Type;
import com.mjw.zstu.mapper.TypeMapper;
import com.mjw.zstu.resultDto.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TypeService {
    @Autowired
    TypeMapper typeMapper;
    public IPage<Type> getlist(int pageNum,int pageSize){
        Page page=new Page<Type>(pageNum,pageSize);
        QueryWrapper<Type> typeQueryWrapper=new QueryWrapper<>();
        return typeMapper.selectMapsPage(page,typeQueryWrapper);
    }
//    public JsonResult list(){
//        List l=typeMapper.
//    }
    public int deleteType(int id){
        return typeMapper.deleteById(id);
    }
    public int addType(Type type){
        return typeMapper.insert(type);
    }
    public JsonResult update(Type type){
        typeMapper.updateById(type);
        return new JsonResult(200,"更新成功",null);
    }
}
